package sis.threadtest;/*
 * @auther 顶风少年
 * @mail dfsn19970313@foxmail.com
 * @date 2019-08-02 16:43
 * @notify
 * @version 1.0
 */

public class MyThreadLocal implements Runnable {
    private ThreadLocal<Integer> tl;

    public MyThreadLocal() {
        tl = new ThreadLocal() {
            protected Integer initialValue() {
                return 0;
            }
        };
    }

    public void run() {
        tl.set(tl.get()+1);
        System.out.println(tl.get());
    }
}
